package com.fy.market.strategy.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author fwq
 * @desc 用户删除状态枚举
 * @date 2025-09-26
 */
@Getter
@AllArgsConstructor
public enum DeletedEnum {

    /**
     * 正常使用
     */
    NORMAL(0, "正常状态"),

    /**
     * 用户已永久注销
     */
    DELETED(1, "删除状态");

    private final Integer code;
    private final String info;

    /**
     * 根据code获取枚举
     *
     * @param code 删除状态码
     * @return 用户删除状态枚举
     */
    public static DeletedEnum of(Integer code) {
        if (code == null) {
            return null;
        }
        for (DeletedEnum userDeletedEnum : values()) {
            if (userDeletedEnum.getCode().equals(code)) {
                return userDeletedEnum;
            }
        }
        return null;
    }
}